/**
 */
package org.aphelie.romancer.model.chronicle.impl;



import org.aphelie.romancer.model.chronicle.Chronicle;
import org.aphelie.romancer.model.chronicle.ChronicleFactory;
import org.aphelie.romancer.model.chronicle.ChroniclePackage;
import org.aphelie.romancer.model.chronicle.Personnage;
import org.aphelie.romancer.model.chronicle.document.DocumentPackage;
import org.aphelie.romancer.model.chronicle.document.impl.DocumentPackageImpl;

import org.aphelie.romancer.model.chronicle.entity.EntityPackage;
import org.aphelie.romancer.model.chronicle.entity.impl.EntityPackageImpl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ChroniclePackageImpl extends EPackageImpl implements ChroniclePackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass chronicleEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass personnageEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see org.aphelie.romancer.model.chronicle.ChroniclePackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private ChroniclePackageImpl() {
		super(eNS_URI, ChronicleFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link ChroniclePackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static ChroniclePackage init() {
		if (isInited) return (ChroniclePackage)EPackage.Registry.INSTANCE.getEPackage(ChroniclePackage.eNS_URI);

		// Obtain or create and register package
		ChroniclePackageImpl theChroniclePackage = (ChroniclePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ChroniclePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ChroniclePackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		DocumentPackageImpl theDocumentPackage = (DocumentPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(DocumentPackage.eNS_URI) instanceof DocumentPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(DocumentPackage.eNS_URI) : DocumentPackage.eINSTANCE);
		EntityPackageImpl theEntityPackage = (EntityPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EntityPackage.eNS_URI) instanceof EntityPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EntityPackage.eNS_URI) : EntityPackage.eINSTANCE);

		// Create package meta-data objects
		theChroniclePackage.createPackageContents();
		theDocumentPackage.createPackageContents();
		theEntityPackage.createPackageContents();

		// Initialize created meta-data
		theChroniclePackage.initializePackageContents();
		theDocumentPackage.initializePackageContents();
		theEntityPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theChroniclePackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(ChroniclePackage.eNS_URI, theChroniclePackage);
		return theChroniclePackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getChronicle() {
		return chronicleEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getChronicle_Characters() {
		return (EReference)chronicleEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getChronicle_Personnages() {
		return (EReference)chronicleEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getChronicle_Documents() {
		return (EReference)chronicleEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getPersonnage() {
		return personnageEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getPersonnage_Vertue() {
		return (EAttribute)personnageEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ChronicleFactory getChronicleFactory() {
		return (ChronicleFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		chronicleEClass = createEClass(CHRONICLE);
		createEReference(chronicleEClass, CHRONICLE__CHARACTERS);
		createEReference(chronicleEClass, CHRONICLE__PERSONNAGES);
		createEReference(chronicleEClass, CHRONICLE__DOCUMENTS);

		personnageEClass = createEClass(PERSONNAGE);
		createEAttribute(personnageEClass, PERSONNAGE__VERTUE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		DocumentPackage theDocumentPackage = (DocumentPackage)EPackage.Registry.INSTANCE.getEPackage(DocumentPackage.eNS_URI);
		EntityPackage theEntityPackage = (EntityPackage)EPackage.Registry.INSTANCE.getEPackage(EntityPackage.eNS_URI);

		// Add subpackages
		getESubpackages().add(theDocumentPackage);
		getESubpackages().add(theEntityPackage);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes

		// Initialize classes and features; add operations and parameters
		initEClass(chronicleEClass, Chronicle.class, "Chronicle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getChronicle_Characters(), theEntityPackage.getCharacter(), null, "characters", null, 0, -1, Chronicle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getChronicle_Personnages(), this.getPersonnage(), null, "personnages", null, 0, -1, Chronicle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getChronicle_Documents(), theDocumentPackage.getDocument(), null, "documents", null, 0, -1, Chronicle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(personnageEClass, Personnage.class, "Personnage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getPersonnage_Vertue(), ecorePackage.getEString(), "vertue", null, 0, 1, Personnage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Create resource
		createResource(eNS_URI);
	}

} //ChroniclePackageImpl
